package com.tiancheng.trade.merchant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

@Getter
@AllArgsConstructor
public enum AgreementSignSourceEnums {
    PC("PC","PC端"),
    H5("H5","H5端"),
    ;

    private final String code;
    private final String desc;

    /**
     * 根据code获取具体枚举，一般switch中使用
     *
     * @param code
     * @return
     */
    public static AgreementSignSourceEnums getByCode(String code) {
        return Arrays.stream(values()).filter(d -> Objects.equals(d.getCode(), code)).findFirst().orElse(null);
    }
}
